function UserLogin(body, success, fail) {
    var url = base_server_url + USER_LOGIN

    ajaxPost(url, body, function(response) {
        var data = response;
        if (data.result_code == 0) {
            //存储token
            $.zui.store.set("user", data.result_data);
            success(data.result_data)
        } else {
            fail(data.result_desc);
        }
    }, function(error) {
        fail("网络错误");
    });
}


function MenuGetAll(success, fail) {
    var url = base_server_url + MENU_GET_ALL
    ajaxGet(url, "", function(response) {
        var data = response;
        if (data.result_code == 0) {
            success(data.result_data)
        } else {
            fail(data.result_desc);
        }
    }, function(error) {
        fail("网络错误");
    });
}

function DeptGetAll(success, fail) {
    var url = base_server_url + DEPT_GET_ALL
    ajaxGet(url, "", function(response) {
        var data = response;
        if (data.result_code == 0) {
            success(data.result_data)
        } else {
            fail(data.result_desc);
        }
    }, function(error) {
        fail("网络错误");
    });
}

function DeptAdd(data, success, fail) {
    var url = base_server_url + DEPT_ADD
    ajaxPost(url, data, function(response) {
        var data = response;
        if (data.result_code == 0) {
            success(data.result_data)
        } else {
            fail(data.result_desc);
        }
    }, function(error) {
        fail("网络错误");
    });
}

function getConstantList(url, param, success, fail) {
    var url = base_server_url + url;
    ajaxPost(url, param, function(response) {
        var data = response;
        if (data.result_code == 0) {
            success(data.result_data)
        } else {
            fail(data.result_desc);
        }
    }, function(error) {
        fail("网络错误");
    });
}

function addConstant_service(url, param, success, fail) {
    var url = base_server_url + url;
    ajaxPost(url, param, function(response) {
        var data = response;
        if (data.result_code == 0) {
            success(data.result_desc)
        } else {
            fail(data.result_desc);
        }
    }, function(error) {
        fail("网络错误");
    });
}